var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-29614248-1']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

track =  {version: "0.1"};
track.event = null;

function trackEvent(cat, action, label, value) {
//    console.log("Track["+cat+","+action+","+label+"]");
    _gaq.push(['_trackEvent', cat, action, label, value]);
    if (track.event)
      track.event(cat, action, label, value);
}

function trackEventDeferred(delay, cat, action, label, value) {
    return window.setTimeout(function() {
        trackEvent(cat, action, label, value);
    }, delay);
}

function clearTrackEvent(id) {
    if(typeof id == "number") {
        clearTimeout(id);
//        console.log("Clearing "+id);
    }
}
